// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import $ from 'jquery'
import 'bootstrap/dist/css/bootstrap.min.css'
import './libs/base.min.css'
import 'bootstrap/dist/js/bootstrap.min'
import Vue from 'vue'
import App from './App'
import router from './router'
import iView from 'iview'
import store from './store'
import 'iview/dist/styles/iview.css'
import './request'
import './static/vue.component.js'
import './static/myfilter.js'
import VueI18n from 'vue-i18n'
import axios from 'axios'

import cn from 'iview/dist/locale/zh-CN'
import en from 'iview/dist/locale/en-US'
import yu from 'iview/dist/locale/vi-VN'

import {
  formatTreeMount,
  formatRequestStr
} from './libs/util';

Vue.use(iView)
Vue.use(VueI18n)
Vue.locale = () => {}
Vue.config.productionTip = false

const i18n = new VueI18n({
  locale: localStorage.getItem("X-LANGUAGE"), // 语言标识
  messages: {
    'zh-CN': Object.assign(require('./common/lang/cn'), cn), // 中文语言包
    'en-US': Object.assign(require('./common/lang/en'), en), // 英文语言包
    'yu-VN': Object.assign(require('./common/lang/yu'), yu) // 越文语言包
  }
})

Vue.prototype.formatTreeMount = formatTreeMount;
Vue.prototype.formatRequestStr = formatRequestStr;

Vue.prototype.$axios = axios.create({
  headers: {
    'x-peacock-auth': localStorage.getItem('x-peacock-auth'),
    'Content-Type': 'application/json;charset=UTF-8'
  },
  timeout: 8000
})
/* eslint-disable no-new */

const base_url = '/helsinki/admin/'

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  template: '<App/>',
  components: { App }
})
